1 + 1[1] 2
Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see https://quarto.org.
When you click the Render button a document will be generated that includes both content and the output of embedded code. You can embed code like this:
1 + 1[1] 2
You can add options to executable code like this
[1] 4
The echo: false option disables the printing of code (only output is displayed).
Este es area de una circunferencia \(rea_{Circunferencia}=pi\cdot r^2\)
Esta es una formula cualquiera \[\frac{\left(2x-1\right)^2-1}{4}=k\]
source('https://inkaverse.com/setup.r')Warning: package 'psych' was built under R version 4.4.2
Warning: package 'cowplot' was built under R version 4.4.2
ℹ The googlesheets4 package is using a cached token for
'7485735121@untrm.edu.pe'.
ℹ The googledrive package is using a cached token for
'7485735121@untrm.edu.pe'.
url <- "https://docs.google.com/spreadsheets/d/15r7ZwcZZHbEgltlF6gSFvCTFA-CFzVBWwg3mFlRyKPs/edit?gid=172957346#gid=172957346"
gs <- url %>%
as_sheets_id()
fb <- gs %>%
range_read("fb")✔ Reading from "LA MOLINA 2014 POTATO WUE (FB)".
✔ Range ''fb''.
str(fb)tibble [150 × 18] (S3: tbl_df/tbl/data.frame)
$ riego : chr [1:150] "sequia" "sequia" "irrigado" "sequia" ...
$ geno : chr [1:150] "G01" "G02" "G01" "G02" ...
$ block : num [1:150] 2 4 3 1 2 5 1 4 2 1 ...
$ bloque : chr [1:150] "II" "IV" "III" "I" ...
$ spad_29: num [1:150] 56.3 52.7 49.2 55.5 58.2 43.5 57.4 56.1 61 60.3 ...
$ spad_83: num [1:150] 41.1 47.9 41.6 44.2 32.6 37.8 42.5 35.9 57.5 41.8 ...
$ rwc_84 : num [1:150] 61.5 63.2 67.7 64.9 74.5 ...
$ op_84 : num [1:150] -2.43 -3.03 -2.5 -2.4 -2.27 ...
$ leafdw : num [1:150] 13.28 9.42 18.22 8.84 14.55 ...
$ stemdw : num [1:150] 14.87 8.63 24.19 6.58 12.63 ...
$ rootdw : num [1:150] 3.83 2.1 3.16 2 1.83 2.83 2.28 3.65 4.04 4.17 ...
$ tubdw : num [1:150] 19.8 17.7 38 13.5 51.1 ...
$ biomdw : num [1:150] 51.8 37.8 83.6 30.9 80.2 ...
$ hi : num [1:150] 0.45 0.43 0.455 0.437 0.638 ...
$ ttrans : num [1:150] 4.5 3.54 8.39 2.9 7.37 ...
$ wue : num [1:150] 11.51 10.69 9.97 10.65 10.88 ...
$ twue : num [1:150] 4.4 4.99 4.53 4.65 6.94 ...
$ lfa : num [1:150] 2900 2619 7579 2450 5413 ...
modelo <- aov(formula = lfa ~ bloque + riego + geno + riego*geno
,data = fb)
anova(modelo)
## Analysis of Variance Table
##
## Response: lfa
## Df Sum Sq Mean Sq F value Pr(>F)
## bloque 4 3435339 858835 1.5616 0.1892
## riego 1 788556926 788556926 1433.7957 <0.0000000000000002 ***
## geno 14 261729564 18694969 33.9922 <0.0000000000000002 ***
## riego:geno 14 108147972 7724855 14.0457 <0.0000000000000002 ***
## Residuals 116 63797516 549979
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(modelo)ggplot(fb, aes(x = geno, y = lfa, colour = riego)) +
geom_boxplot(outlier.colour = "red", outlier.shape = 16, outlier.size = 2) +
labs(title = "Boxplot con interacción de niveles de riego y genotipo",
x = "Interacción Riego y Genotipo",
y = "Area Folicar (cm^2)") theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) # Inclinar etiquetas del eje X
## List of 136
## $ line :List of 6
## ..$ colour : chr "black"
## ..$ linewidth : num 0.5
## ..$ linetype : num 1
## ..$ lineend : chr "butt"
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ rect :List of 5
## ..$ fill : chr "white"
## ..$ colour : chr "black"
## ..$ linewidth : num 0.5
## ..$ linetype : num 1
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ text :List of 11
## ..$ family : chr ""
## ..$ face : chr "plain"
## ..$ colour : chr "black"
## ..$ size : num 11
## ..$ hjust : num 0.5
## ..$ vjust : num 0.5
## ..$ angle : num 0
## ..$ lineheight : num 0.9
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ title : NULL
## $ aspect.ratio : NULL
## $ axis.title : NULL
## $ axis.title.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.75points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.75points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.bottom : NULL
## $ axis.title.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num 90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.75points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.y.left : NULL
## $ axis.title.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num -90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.75points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : chr "grey30"
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 1
## ..$ vjust : num 1
## ..$ angle : num 45
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.2points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi FALSE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.2points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.bottom : NULL
## $ axis.text.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 1
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.y.left : NULL
## $ axis.text.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.theta : NULL
## $ axis.text.r :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0.5
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.ticks : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.ticks.x : NULL
## $ axis.ticks.x.top : NULL
## $ axis.ticks.x.bottom : NULL
## $ axis.ticks.y : NULL
## $ axis.ticks.y.left : NULL
## $ axis.ticks.y.right : NULL
## $ axis.ticks.theta : NULL
## $ axis.ticks.r : NULL
## $ axis.minor.ticks.x.top : NULL
## $ axis.minor.ticks.x.bottom : NULL
## $ axis.minor.ticks.y.left : NULL
## $ axis.minor.ticks.y.right : NULL
## $ axis.minor.ticks.theta : NULL
## $ axis.minor.ticks.r : NULL
## $ axis.ticks.length : 'simpleUnit' num 2.75points
## ..- attr(*, "unit")= int 8
## $ axis.ticks.length.x : NULL
## $ axis.ticks.length.x.top : NULL
## $ axis.ticks.length.x.bottom : NULL
## $ axis.ticks.length.y : NULL
## $ axis.ticks.length.y.left : NULL
## $ axis.ticks.length.y.right : NULL
## $ axis.ticks.length.theta : NULL
## $ axis.ticks.length.r : NULL
## $ axis.minor.ticks.length : 'rel' num 0.75
## $ axis.minor.ticks.length.x : NULL
## $ axis.minor.ticks.length.x.top : NULL
## $ axis.minor.ticks.length.x.bottom: NULL
## $ axis.minor.ticks.length.y : NULL
## $ axis.minor.ticks.length.y.left : NULL
## $ axis.minor.ticks.length.y.right : NULL
## $ axis.minor.ticks.length.theta : NULL
## $ axis.minor.ticks.length.r : NULL
## $ axis.line : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.line.x : NULL
## $ axis.line.x.top : NULL
## $ axis.line.x.bottom : NULL
## $ axis.line.y : NULL
## $ axis.line.y.left : NULL
## $ axis.line.y.right : NULL
## $ axis.line.theta : NULL
## $ axis.line.r : NULL
## $ legend.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## $ legend.spacing.x : NULL
## $ legend.spacing.y : NULL
## $ legend.key : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.key.size : 'simpleUnit' num 1.2lines
## ..- attr(*, "unit")= int 3
## $ legend.key.height : NULL
## $ legend.key.width : NULL
## $ legend.key.spacing : 'simpleUnit' num 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.key.spacing.x : NULL
## $ legend.key.spacing.y : NULL
## $ legend.frame : NULL
## $ legend.ticks : NULL
## $ legend.ticks.length : 'rel' num 0.2
## $ legend.axis.line : NULL
## $ legend.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.text.position : NULL
## $ legend.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.title.position : NULL
## $ legend.position : chr "right"
## $ legend.position.inside : NULL
## $ legend.direction : NULL
## $ legend.byrow : NULL
## $ legend.justification : chr "center"
## $ legend.justification.top : NULL
## $ legend.justification.bottom : NULL
## $ legend.justification.left : NULL
## $ legend.justification.right : NULL
## $ legend.justification.inside : NULL
## $ legend.location : NULL
## $ legend.box : NULL
## $ legend.box.just : NULL
## $ legend.box.margin : 'margin' num [1:4] 0cm 0cm 0cm 0cm
## ..- attr(*, "unit")= int 1
## $ legend.box.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.box.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## [list output truncated]
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi TRUE
## - attr(*, "validate")= logi TRUEmodelo <- aov(formula = hi ~ bloque + riego + geno + riego*geno
,data = fb)
anova(modelo)
## Analysis of Variance Table
##
## Response: hi
## Df Sum Sq Mean Sq F value Pr(>F)
## bloque 4 0.09111 0.022778 7.0747 0.00003925028 ***
## riego 1 0.12176 0.121758 37.8165 0.00000001135 ***
## geno 14 2.70077 0.192912 59.9161 < 0.00000000000000022 ***
## riego:geno 14 0.07762 0.005544 1.7219 0.06019 .
## Residuals 116 0.37349 0.003220
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(modelo)ggplot(fb, aes(x = geno, y = hi, colour = riego)) +
geom_boxplot(outlier.colour = "red" , outlier.shape = 16, outlier.size = 2) +
labs(title = "boxplot con interacción de niveles de riego y genotipo" ,
x = "Interacción Riego y Genotipo",
y = "Valor de la variable respuesta") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) #Inclinar etiquetas del eje xlibrary(lme4)
library(lmerTest)
model <- lme4::lmer(lfa ~ riego + geno + riego*geno + (1|bloque), data = fb)
anova(model)
## Analysis of Variance Table
## npar Sum Sq Mean Sq F value
## riego 1 788556926 788556926 1433.796
## geno 14 261729564 18694969 33.992
## riego:geno 14 108147972 7724855 14.046
plot(modelo)
ol <- boxplot(lfa ~ riego*geno, fb)ol
## $stats
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
## [1,] 6539.86 2900.00 4631.00 2449.59 5305.77 1811.97 8569.08 2511.13 7205.94
## [2,] 7038.08 2994.58 5162.74 2487.28 5369.88 1953.50 8867.03 2889.83 8189.67
## [3,] 7578.79 2999.66 5233.55 2618.85 5412.51 2107.76 9791.10 3010.27 8913.12
## [4,] 7750.00 3100.00 6478.14 2966.18 5450.00 2147.55 10305.61 3218.63 9793.99
## [5,] 7982.73 3203.70 7392.38 3063.35 5545.69 2274.48 10811.84 3263.70 10291.06
## [,10] [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18]
## [1,] 1657.64 6576.65 3159.54 1065.26 216.31 6998.00 2021.37 8533.54 2781.32
## [2,] 1700.00 6857.13 3198.96 1068.97 495.83 7012.74 2278.60 8924.78 2961.78
## [3,] 1771.80 6938.90 3381.68 1140.05 782.10 7310.01 2319.71 10764.71 3150.00
## [4,] 1821.46 7864.08 3450.00 1607.25 811.45 7469.58 2550.51 10919.31 3235.10
## [5,] 1967.49 9040.06 3550.19 1989.25 1097.98 7643.80 2697.93 12296.22 3238.41
## [,19] [,20] [,21] [,22] [,23] [,24] [,25] [,26] [,27]
## [1,] 4249.18 2909.10 3966.33 1556.38 6111.43 2400.00 7180.79 3062.34 6049.52
## [2,] 4743.16 2909.10 6210.41 1942.23 7164.03 2425.26 8256.98 3110.00 7895.00
## [3,] 5171.21 2940.95 7225.02 2237.88 7194.26 2438.98 8750.00 3120.00 8978.89
## [4,] 6028.93 3096.00 8005.55 2274.26 8012.79 2480.00 9430.43 3146.19 9221.24
## [5,] 6164.24 3136.07 8867.09 2301.31 8603.78 2487.78 9743.70 3191.97 9776.01
## [,28] [,29] [,30]
## [1,] 3318.36 6270.00 1560.00
## [2,] 3326.93 6302.79 1560.00
## [3,] 3449.76 6304.88 1601.06
## [4,] 3664.65 6435.00 1750.00
## [5,] 3811.99 6522.46 1814.84
##
## $n
## [1] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
##
## $conf
## [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
## [1,] 7075.749 2925.17 4304.092 2280.46 5355.897 1970.645 8774.603 2777.941
## [2,] 8081.831 3074.15 6163.008 2957.24 5469.123 2244.875 10807.597 3242.599
## [,9] [,10] [,11] [,12] [,13] [,14] [,15] [,16]
## [1,] 7779.512 1685.977 6227.392 3204.296 759.7027 559.0837 6987.208 2127.579
## [2,] 10046.728 1857.623 7650.408 3559.064 1520.3973 1005.1163 7632.812 2511.841
## [,17] [,18] [,19] [,20] [,21] [,22] [,23] [,24]
## [1,] 9355.38 2956.873 4262.688 2808.887 5956.579 2003.268 6594.528 2400.301
## [2,] 12174.04 3343.127 6079.732 3073.013 8493.461 2472.492 7793.992 2477.659
## [,25] [,26] [,27] [,28] [,29] [,30]
## [1,] 7920.843 3094.428 8041.772 3211.128 6211.461 1466.806
## [2,] 9579.157 3145.572 9916.008 3688.392 6398.299 1735.314
##
## $out
## [1] 2541.12 1176.63
##
## $group
## [1] 20 30
##
## $names
## [1] "irrigado.G01" "sequia.G01" "irrigado.G02" "sequia.G02" "irrigado.G03"
## [6] "sequia.G03" "irrigado.G04" "sequia.G04" "irrigado.G05" "sequia.G05"
## [11] "irrigado.G06" "sequia.G06" "irrigado.G07" "sequia.G07" "irrigado.G08"
## [16] "sequia.G08" "irrigado.G09" "sequia.G09" "irrigado.G10" "sequia.G10"
## [21] "irrigado.G11" "sequia.G11" "irrigado.G12" "sequia.G12" "irrigado.G13"
## [26] "sequia.G13" "irrigado.G14" "sequia.G14" "irrigado.G15" "sequia.G15"library(inti)
model <- remove_outliers(data = fb
,formula = lfa ~ riego + geno + riego*geno + (1|bloque)
,plot_diag = T
)
modelo
## Call:
## aov(formula = hi ~ bloque + riego + geno + riego * geno, data = fb)
##
## Terms:
## bloque riego geno riego:geno Residuals
## Sum of Squares 0.0911139 0.1217579 2.7007652 0.0776158 0.3734853
## Deg. of Freedom 4 1 14 14 116
##
## Residual standard error: 0.05674241
## Estimated effects may be unbalancedmodelo <- aov(formula = lfa ~ bloque + riego + geno + riego*geno
,data = fb)
anova(modelo)
## Analysis of Variance Table
##
## Response: lfa
## Df Sum Sq Mean Sq F value Pr(>F)
## bloque 4 3435339 858835 1.5616 0.1892
## riego 1 788556926 788556926 1433.7957 <0.0000000000000002 ***
## geno 14 261729564 18694969 33.9922 <0.0000000000000002 ***
## riego:geno 14 108147972 7724855 14.0457 <0.0000000000000002 ***
## Residuals 116 63797516 549979
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(agricolae)
tukey_result <- HSD.test(modelo
, c("geno" , "riego")
, group = TRUE)
print(tukey_result)
## $statistics
## MSerror Df Mean CV MSD
## 549978.6 116 4806.708 15.42855 1803.603
##
## $parameters
## test name.t ntr StudentizedRange alpha
## Tukey geno:riego 30 5.438172 0.05
##
## $means
## lfa std r se Min Max Q25 Q50
## G01:irrigado 7377.892 583.61443 5 331.656 6539.86 7982.73 7038.08 7578.79
## G01:sequia 3039.588 115.85242 5 331.656 2900.00 3203.70 2994.58 2999.66
## G02:irrigado 5779.562 1127.71742 5 331.656 4631.00 7392.38 5162.74 5233.55
## G02:sequia 2717.050 281.05239 5 331.656 2449.59 3063.35 2487.28 2618.85
## G03:irrigado 5416.770 89.80871 5 331.656 5305.77 5545.69 5369.88 5412.51
## G03:sequia 2059.052 179.44660 5 331.656 1811.97 2274.48 1953.50 2107.76
## G04:irrigado 9668.932 945.94448 5 331.656 8569.08 10811.84 8867.03 9791.10
## G04:sequia 2978.712 302.61678 5 331.656 2511.13 3263.70 2889.83 3010.27
## G05:irrigado 8878.756 1235.57574 5 331.656 7205.94 10291.06 8189.67 8913.12
## G05:sequia 1783.678 120.66794 5 331.656 1657.64 1967.49 1700.00 1771.80
## G06:irrigado 7455.364 1009.33982 5 331.656 6576.65 9040.06 6857.13 6938.90
## G06:sequia 3348.074 165.94367 5 331.656 3159.54 3550.19 3198.96 3381.68
## G07:irrigado 1374.156 411.10652 5 331.656 1065.26 1989.25 1068.97 1140.05
## G07:sequia 680.734 335.90739 5 331.656 216.31 1097.98 495.83 782.10
## G08:irrigado 7286.826 282.80318 5 331.656 6998.00 7643.80 7012.74 7310.01
## G08:sequia 2373.624 260.99914 5 331.656 2021.37 2697.93 2278.60 2319.71
## G09:irrigado 10287.712 1548.81007 5 331.656 8533.54 12296.22 8924.78 10764.71
## G09:sequia 3073.322 198.12400 5 331.656 2781.32 3238.41 2961.78 3150.00
## G10:irrigado 5271.344 822.34789 5 331.656 4249.18 6164.24 4743.16 5171.21
## G10:sequia 2924.648 235.40497 5 331.656 2541.12 3136.07 2909.10 2940.95
## G11:irrigado 6854.880 1888.72290 5 331.656 3966.33 8867.09 6210.41 7225.02
## G11:sequia 2062.412 317.51100 5 331.656 1556.38 2301.31 1942.23 2237.88
## G12:irrigado 7417.258 946.24681 5 331.656 6111.43 8603.78 7164.03 7194.26
## G12:sequia 2446.404 37.06811 5 331.656 2400.00 2487.78 2425.26 2438.98
## G13:irrigado 8672.380 1015.60193 5 331.656 7180.79 9743.70 8256.98 8750.00
## G13:sequia 3126.100 47.70803 5 331.656 3062.34 3191.97 3110.00 3120.00
## G14:irrigado 8384.132 1473.21710 5 331.656 6049.52 9776.01 7895.00 8978.89
## G14:sequia 3514.338 217.30731 5 331.656 3318.36 3811.99 3326.93 3449.76
## G15:irrigado 6367.026 107.45072 5 331.656 6270.00 6522.46 6302.79 6304.88
## G15:sequia 1580.506 248.79682 5 331.656 1176.63 1814.84 1560.00 1601.06
## Q75
## G01:irrigado 7750.00
## G01:sequia 3100.00
## G02:irrigado 6478.14
## G02:sequia 2966.18
## G03:irrigado 5450.00
## G03:sequia 2147.55
## G04:irrigado 10305.61
## G04:sequia 3218.63
## G05:irrigado 9793.99
## G05:sequia 1821.46
## G06:irrigado 7864.08
## G06:sequia 3450.00
## G07:irrigado 1607.25
## G07:sequia 811.45
## G08:irrigado 7469.58
## G08:sequia 2550.51
## G09:irrigado 10919.31
## G09:sequia 3235.10
## G10:irrigado 6028.93
## G10:sequia 3096.00
## G11:irrigado 8005.55
## G11:sequia 2274.26
## G12:irrigado 8012.79
## G12:sequia 2480.00
## G13:irrigado 9430.43
## G13:sequia 3146.19
## G14:irrigado 9221.24
## G14:sequia 3664.65
## G15:irrigado 6435.00
## G15:sequia 1750.00
##
## $comparison
## NULL
##
## $groups
## lfa groups
## G09:irrigado 10287.712 a
## G04:irrigado 9668.932 ab
## G05:irrigado 8878.756 abc
## G13:irrigado 8672.380 abc
## G14:irrigado 8384.132 bcd
## G06:irrigado 7455.364 cde
## G12:irrigado 7417.258 cde
## G01:irrigado 7377.892 cde
## G08:irrigado 7286.826 cde
## G11:irrigado 6854.880 def
## G15:irrigado 6367.026 ef
## G02:irrigado 5779.562 ef
## G03:irrigado 5416.770 f
## G10:irrigado 5271.344 fg
## G14:sequia 3514.338 gh
## G06:sequia 3348.074 hi
## G13:sequia 3126.100 hij
## G09:sequia 3073.322 hij
## G01:sequia 3039.588 hij
## G04:sequia 2978.712 hij
## G10:sequia 2924.648 hij
## G02:sequia 2717.050 hij
## G12:sequia 2446.404 hijk
## G08:sequia 2373.624 hijk
## G11:sequia 2062.412 hijk
## G03:sequia 2059.052 hijk
## G05:sequia 1783.678 hijk
## G15:sequia 1580.506 ijk
## G07:irrigado 1374.156 jk
## G07:sequia 680.734 k
##
## attr(,"class")
## [1] "group"
plot(tukey_result)
str(tukey_result)
## List of 5
## $ statistics:'data.frame': 1 obs. of 5 variables:
## ..$ MSerror: num 549979
## ..$ Df : int 116
## ..$ Mean : num 4807
## ..$ CV : num 15.4
## ..$ MSD : num 1804
## $ parameters:'data.frame': 1 obs. of 5 variables:
## ..$ test : chr "Tukey"
## ..$ name.t : chr "geno:riego"
## ..$ ntr : int 30
## ..$ StudentizedRange: num 5.44
## ..$ alpha : num 0.05
## $ means :'data.frame': 30 obs. of 9 variables:
## ..$ lfa: num [1:30] 7378 3040 5780 2717 5417 ...
## ..$ std: num [1:30] 583.6 115.9 1127.7 281.1 89.8 ...
## ..$ r : int [1:30] 5 5 5 5 5 5 5 5 5 5 ...
## ..$ se : num [1:30] 332 332 332 332 332 ...
## ..$ Min: num [1:30] 6540 2900 4631 2450 5306 ...
## ..$ Max: num [1:30] 7983 3204 7392 3063 5546 ...
## ..$ Q25: num [1:30] 7038 2995 5163 2487 5370 ...
## ..$ Q50: num [1:30] 7579 3000 5234 2619 5413 ...
## ..$ Q75: num [1:30] 7750 3100 6478 2966 5450 ...
## $ comparison: NULL
## $ groups :'data.frame': 30 obs. of 2 variables:
## ..$ lfa : num [1:30] 10288 9669 8879 8672 8384 ...
## ..$ groups: chr [1:30] "a" "ab" "abc" "abc" ...
## - attr(*, "class")= chr "group"
tukey_result
## $statistics
## MSerror Df Mean CV MSD
## 549978.6 116 4806.708 15.42855 1803.603
##
## $parameters
## test name.t ntr StudentizedRange alpha
## Tukey geno:riego 30 5.438172 0.05
##
## $means
## lfa std r se Min Max Q25 Q50
## G01:irrigado 7377.892 583.61443 5 331.656 6539.86 7982.73 7038.08 7578.79
## G01:sequia 3039.588 115.85242 5 331.656 2900.00 3203.70 2994.58 2999.66
## G02:irrigado 5779.562 1127.71742 5 331.656 4631.00 7392.38 5162.74 5233.55
## G02:sequia 2717.050 281.05239 5 331.656 2449.59 3063.35 2487.28 2618.85
## G03:irrigado 5416.770 89.80871 5 331.656 5305.77 5545.69 5369.88 5412.51
## G03:sequia 2059.052 179.44660 5 331.656 1811.97 2274.48 1953.50 2107.76
## G04:irrigado 9668.932 945.94448 5 331.656 8569.08 10811.84 8867.03 9791.10
## G04:sequia 2978.712 302.61678 5 331.656 2511.13 3263.70 2889.83 3010.27
## G05:irrigado 8878.756 1235.57574 5 331.656 7205.94 10291.06 8189.67 8913.12
## G05:sequia 1783.678 120.66794 5 331.656 1657.64 1967.49 1700.00 1771.80
## G06:irrigado 7455.364 1009.33982 5 331.656 6576.65 9040.06 6857.13 6938.90
## G06:sequia 3348.074 165.94367 5 331.656 3159.54 3550.19 3198.96 3381.68
## G07:irrigado 1374.156 411.10652 5 331.656 1065.26 1989.25 1068.97 1140.05
## G07:sequia 680.734 335.90739 5 331.656 216.31 1097.98 495.83 782.10
## G08:irrigado 7286.826 282.80318 5 331.656 6998.00 7643.80 7012.74 7310.01
## G08:sequia 2373.624 260.99914 5 331.656 2021.37 2697.93 2278.60 2319.71
## G09:irrigado 10287.712 1548.81007 5 331.656 8533.54 12296.22 8924.78 10764.71
## G09:sequia 3073.322 198.12400 5 331.656 2781.32 3238.41 2961.78 3150.00
## G10:irrigado 5271.344 822.34789 5 331.656 4249.18 6164.24 4743.16 5171.21
## G10:sequia 2924.648 235.40497 5 331.656 2541.12 3136.07 2909.10 2940.95
## G11:irrigado 6854.880 1888.72290 5 331.656 3966.33 8867.09 6210.41 7225.02
## G11:sequia 2062.412 317.51100 5 331.656 1556.38 2301.31 1942.23 2237.88
## G12:irrigado 7417.258 946.24681 5 331.656 6111.43 8603.78 7164.03 7194.26
## G12:sequia 2446.404 37.06811 5 331.656 2400.00 2487.78 2425.26 2438.98
## G13:irrigado 8672.380 1015.60193 5 331.656 7180.79 9743.70 8256.98 8750.00
## G13:sequia 3126.100 47.70803 5 331.656 3062.34 3191.97 3110.00 3120.00
## G14:irrigado 8384.132 1473.21710 5 331.656 6049.52 9776.01 7895.00 8978.89
## G14:sequia 3514.338 217.30731 5 331.656 3318.36 3811.99 3326.93 3449.76
## G15:irrigado 6367.026 107.45072 5 331.656 6270.00 6522.46 6302.79 6304.88
## G15:sequia 1580.506 248.79682 5 331.656 1176.63 1814.84 1560.00 1601.06
## Q75
## G01:irrigado 7750.00
## G01:sequia 3100.00
## G02:irrigado 6478.14
## G02:sequia 2966.18
## G03:irrigado 5450.00
## G03:sequia 2147.55
## G04:irrigado 10305.61
## G04:sequia 3218.63
## G05:irrigado 9793.99
## G05:sequia 1821.46
## G06:irrigado 7864.08
## G06:sequia 3450.00
## G07:irrigado 1607.25
## G07:sequia 811.45
## G08:irrigado 7469.58
## G08:sequia 2550.51
## G09:irrigado 10919.31
## G09:sequia 3235.10
## G10:irrigado 6028.93
## G10:sequia 3096.00
## G11:irrigado 8005.55
## G11:sequia 2274.26
## G12:irrigado 8012.79
## G12:sequia 2480.00
## G13:irrigado 9430.43
## G13:sequia 3146.19
## G14:irrigado 9221.24
## G14:sequia 3664.65
## G15:irrigado 6435.00
## G15:sequia 1750.00
##
## $comparison
## NULL
##
## $groups
## lfa groups
## G09:irrigado 10287.712 a
## G04:irrigado 9668.932 ab
## G05:irrigado 8878.756 abc
## G13:irrigado 8672.380 abc
## G14:irrigado 8384.132 bcd
## G06:irrigado 7455.364 cde
## G12:irrigado 7417.258 cde
## G01:irrigado 7377.892 cde
## G08:irrigado 7286.826 cde
## G11:irrigado 6854.880 def
## G15:irrigado 6367.026 ef
## G02:irrigado 5779.562 ef
## G03:irrigado 5416.770 f
## G10:irrigado 5271.344 fg
## G14:sequia 3514.338 gh
## G06:sequia 3348.074 hi
## G13:sequia 3126.100 hij
## G09:sequia 3073.322 hij
## G01:sequia 3039.588 hij
## G04:sequia 2978.712 hij
## G10:sequia 2924.648 hij
## G02:sequia 2717.050 hij
## G12:sequia 2446.404 hijk
## G08:sequia 2373.624 hijk
## G11:sequia 2062.412 hijk
## G03:sequia 2059.052 hijk
## G05:sequia 1783.678 hijk
## G15:sequia 1580.506 ijk
## G07:irrigado 1374.156 jk
## G07:sequia 680.734 k
##
## attr(,"class")
## [1] "group"
library(tidyverse)
grupos <- tukey_result$groups %>%
rownames_to_column("tratamientos") %>%
separate(tratamientos, into = c("geno" , "riego")
, sep = ":")
str(grupos)
## 'data.frame': 30 obs. of 4 variables:
## $ geno : chr "G09" "G04" "G05" "G13" ...
## $ riego : chr "irrigado" "irrigado" "irrigado" "irrigado" ...
## $ lfa : num 10288 9669 8879 8672 8384 ...
## $ groups: chr "a" "ab" "abc" "abc" ...ggplot(grupos, aes(x = geno, y = lfa, fill = riego)) +
geom_bar(stat = "identity", position = "dodge", color = "black") +
labs(x = "Genotipo", y = "LFA", fill = "Riego") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggtitle("Gráfico de barras: LFA por genotipo y riego")ggplot(grupos, aes(x = geno, y = lfa, fill = riego)) +
geom_bar(stat = "identity", position = position_dodge()) +
geom_text(aes(label = groups), # Mostrar 'groups' como etiqueta
position = position_dodge(width = 0.9),
vjust = -0.3) + # Ajusta la posición vertical de las etiquetas
labs(title = "Efecto de Geno y Riego en LFA",
x = "Genotipo",
y = "LFA") +
theme_minimal() +
scale_fill_discrete(name = "Riego") +
theme(axis.text.x = element_text(angle =45,hjust=1))source('https://inkaverse.com/setup.r')
library(emmeans)
library(multcomp)
library(multcompView)
modelo <- lme4::lmer(hi ~ (1|bloque) + geno*riego
, data = fb)
anova(modelo)
## Analysis of Variance Table
## npar Sum Sq Mean Sq F value
## geno 14 2.70077 0.192912 59.9161
## riego 1 0.12176 0.121758 37.8165
## geno:riego 14 0.07762 0.005544 1.7219
cm1 <- emmeans(modelo, ~ geno | riego) %>%
cld(Letters = letters, reversed = T)
cm1
## riego = irrigado:
## geno emmean SE df lower.CL upper.CL .group
## G07 0.749 0.0278 65.8 0.6938 0.805 a
## G15 0.680 0.0278 65.8 0.6248 0.736 ab
## G11 0.645 0.0278 65.8 0.5898 0.701 abc
## G03 0.625 0.0278 65.8 0.5695 0.681 abc
## G09 0.605 0.0278 65.8 0.5490 0.660 bcd
## G05 0.580 0.0278 65.8 0.5249 0.636 bcde
## G10 0.555 0.0278 65.8 0.4993 0.610 cdef
## G04 0.546 0.0278 65.8 0.4903 0.601 cdefg
## G12 0.498 0.0278 65.8 0.4427 0.554 defg
## G01 0.472 0.0278 65.8 0.4168 0.528 efgh
## G02 0.455 0.0278 65.8 0.3995 0.511 fgh
## G14 0.436 0.0278 65.8 0.3807 0.492 fgh
## G08 0.429 0.0278 65.8 0.3735 0.485 gh
## G13 0.350 0.0278 65.8 0.2946 0.406 h
## G06 0.221 0.0278 65.8 0.1653 0.276 i
##
## riego = sequia:
## geno emmean SE df lower.CL upper.CL .group
## G07 0.689 0.0278 65.8 0.6335 0.745 a
## G11 0.665 0.0278 65.8 0.6097 0.721 a
## G03 0.593 0.0278 65.8 0.5371 0.648 ab
## G15 0.590 0.0278 65.8 0.5340 0.645 ab
## G10 0.582 0.0278 65.8 0.5261 0.637 ab
## G09 0.511 0.0278 65.8 0.4556 0.567 bc
## G04 0.486 0.0278 65.8 0.4302 0.541 bc
## G05 0.446 0.0278 65.8 0.3908 0.502 cd
## G01 0.441 0.0278 65.8 0.3852 0.496 cd
## G02 0.402 0.0278 65.8 0.3467 0.458 cde
## G12 0.402 0.0278 65.8 0.3467 0.458 cde
## G14 0.389 0.0278 65.8 0.3335 0.445 cde
## G13 0.346 0.0278 65.8 0.2904 0.402 de
## G08 0.315 0.0278 65.8 0.2598 0.371 e
## G06 0.136 0.0278 65.8 0.0807 0.192 f
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## P value adjustment: tukey method for comparing a family of 15 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
cm2 <- emmeans(modelo, ~ riego | geno) %>%
cld(Letters = letters, reversed = T)
cm2
## geno = G01:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.472 0.0278 65.8 0.4168 0.528 a
## sequia 0.441 0.0278 65.8 0.3852 0.496 a
##
## geno = G02:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.455 0.0278 65.8 0.3995 0.511 a
## sequia 0.402 0.0278 65.8 0.3467 0.458 a
##
## geno = G03:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.625 0.0278 65.8 0.5695 0.681 a
## sequia 0.593 0.0278 65.8 0.5371 0.648 a
##
## geno = G04:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.546 0.0278 65.8 0.4903 0.601 a
## sequia 0.486 0.0278 65.8 0.4302 0.541 a
##
## geno = G05:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.580 0.0278 65.8 0.5249 0.636 a
## sequia 0.446 0.0278 65.8 0.3908 0.502 b
##
## geno = G06:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.221 0.0278 65.8 0.1653 0.276 a
## sequia 0.136 0.0278 65.8 0.0807 0.192 b
##
## geno = G07:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.749 0.0278 65.8 0.6938 0.805 a
## sequia 0.689 0.0278 65.8 0.6335 0.745 a
##
## geno = G08:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.429 0.0278 65.8 0.3735 0.485 a
## sequia 0.315 0.0278 65.8 0.2598 0.371 b
##
## geno = G09:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.605 0.0278 65.8 0.5490 0.660 a
## sequia 0.511 0.0278 65.8 0.4556 0.567 b
##
## geno = G10:
## riego emmean SE df lower.CL upper.CL .group
## sequia 0.582 0.0278 65.8 0.5261 0.637 a
## irrigado 0.555 0.0278 65.8 0.4993 0.610 a
##
## geno = G11:
## riego emmean SE df lower.CL upper.CL .group
## sequia 0.665 0.0278 65.8 0.6097 0.721 a
## irrigado 0.645 0.0278 65.8 0.5898 0.701 a
##
## geno = G12:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.498 0.0278 65.8 0.4427 0.554 a
## sequia 0.402 0.0278 65.8 0.3467 0.458 b
##
## geno = G13:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.350 0.0278 65.8 0.2946 0.406 a
## sequia 0.346 0.0278 65.8 0.2904 0.402 a
##
## geno = G14:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.436 0.0278 65.8 0.3807 0.492 a
## sequia 0.389 0.0278 65.8 0.3335 0.445 a
##
## geno = G15:
## riego emmean SE df lower.CL upper.CL .group
## irrigado 0.680 0.0278 65.8 0.6248 0.736 a
## sequia 0.590 0.0278 65.8 0.5340 0.645 b
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.
cm3 <- emmeans(modelo, ~ riego * geno) %>%
cld(Letters = letters, reversed = T)
cm3
## riego geno emmean SE df lower.CL upper.CL .group
## irrigado G07 0.749 0.0278 65.8 0.6938 0.805 a
## sequia G07 0.689 0.0278 65.8 0.6335 0.745 ab
## irrigado G15 0.680 0.0278 65.8 0.6248 0.736 abc
## sequia G11 0.665 0.0278 65.8 0.6097 0.721 abc
## irrigado G11 0.645 0.0278 65.8 0.5898 0.701 abcd
## irrigado G03 0.625 0.0278 65.8 0.5695 0.681 abcde
## irrigado G09 0.605 0.0278 65.8 0.5490 0.660 bcdef
## sequia G03 0.593 0.0278 65.8 0.5371 0.648 bcdefg
## sequia G15 0.590 0.0278 65.8 0.5340 0.645 bcdefg
## sequia G10 0.582 0.0278 65.8 0.5261 0.637 bcdefgh
## irrigado G05 0.580 0.0278 65.8 0.5249 0.636 bcdefgh
## irrigado G10 0.555 0.0278 65.8 0.4993 0.610 bcdefghi
## irrigado G04 0.546 0.0278 65.8 0.4903 0.601 cdefghi
## sequia G09 0.511 0.0278 65.8 0.4556 0.567 defghij
## irrigado G12 0.498 0.0278 65.8 0.4427 0.554 efghij
## sequia G04 0.486 0.0278 65.8 0.4302 0.541 fghijk
## irrigado G01 0.472 0.0278 65.8 0.4168 0.528 fghijkl
## irrigado G02 0.455 0.0278 65.8 0.3995 0.511 ghijkl
## sequia G05 0.446 0.0278 65.8 0.3908 0.502 hijklm
## sequia G01 0.441 0.0278 65.8 0.3852 0.496 ijklm
## irrigado G14 0.436 0.0278 65.8 0.3807 0.492 ijklm
## irrigado G08 0.429 0.0278 65.8 0.3735 0.485 ijklm
## sequia G02 0.402 0.0278 65.8 0.3467 0.458 jklm
## sequia G12 0.402 0.0278 65.8 0.3467 0.458 jklm
## sequia G14 0.389 0.0278 65.8 0.3335 0.445 jklm
## irrigado G13 0.350 0.0278 65.8 0.2946 0.406 klmn
## sequia G13 0.346 0.0278 65.8 0.2904 0.402 lmn
## sequia G08 0.315 0.0278 65.8 0.2598 0.371 mn
## irrigado G06 0.221 0.0278 65.8 0.1653 0.276 no
## sequia G06 0.136 0.0278 65.8 0.0807 0.192 o
##
## Degrees-of-freedom method: kenward-roger
## Confidence level used: 0.95
## P value adjustment: tukey method for comparing a family of 30 estimates
## significance level used: alpha = 0.05
## NOTE: If two or more means share the same grouping symbol,
## then we cannot show them to be different.
## But we also did not show them to be the same.#Grafico
library(ggplot2)
dtcm <- as.data.frame(cm1) %>%
rename(sig = ".group")
ggplot(dtcm, aes(x = geno, y = emmean, fill = riego)) +
geom_bar(stat = "identity", position = "dodge", color =
"black") +
geom_text(aes(label = sig, y = emmean),
position = position_dodge(width = 0.9),
vjust = 0) +
labs(x = "Genotipo", y = "HI", fill = "Riego") +
theme_minimal() +
theme(axis.text.x = element_text(angle = 45, hjust = 1)) +
ggtitle("Gráfico de barras: LFA por genotipo y riego")str(fb)
## tibble [150 × 18] (S3: tbl_df/tbl/data.frame)
## $ riego : chr [1:150] "sequia" "sequia" "irrigado" "sequia" ...
## $ geno : chr [1:150] "G01" "G02" "G01" "G02" ...
## $ block : num [1:150] 2 4 3 1 2 5 1 4 2 1 ...
## $ bloque : chr [1:150] "II" "IV" "III" "I" ...
## $ spad_29: num [1:150] 56.3 52.7 49.2 55.5 58.2 43.5 57.4 56.1 61 60.3 ...
## $ spad_83: num [1:150] 41.1 47.9 41.6 44.2 32.6 37.8 42.5 35.9 57.5 41.8 ...
## $ rwc_84 : num [1:150] 61.5 63.2 67.7 64.9 74.5 ...
## $ op_84 : num [1:150] -2.43 -3.03 -2.5 -2.4 -2.27 ...
## $ leafdw : num [1:150] 13.28 9.42 18.22 8.84 14.55 ...
## $ stemdw : num [1:150] 14.87 8.63 24.19 6.58 12.63 ...
## $ rootdw : num [1:150] 3.83 2.1 3.16 2 1.83 2.83 2.28 3.65 4.04 4.17 ...
## $ tubdw : num [1:150] 19.8 17.7 38 13.5 51.1 ...
## $ biomdw : num [1:150] 51.8 37.8 83.6 30.9 80.2 ...
## $ hi : num [1:150] 0.45 0.43 0.455 0.437 0.638 ...
## $ ttrans : num [1:150] 4.5 3.54 8.39 2.9 7.37 ...
## $ wue : num [1:150] 11.51 10.69 9.97 10.65 10.88 ...
## $ twue : num [1:150] 4.4 4.99 4.53 4.65 6.94 ...
## $ lfa : num [1:150] 2900 2619 7579 2450 5413 ...library(tidyverse)
library(psych)
fb %>%
select_if(is.numeric) %>%
dplyr::select(!c("block")) %>%
pairs.panels(x = .
, hist.col="red"
, pch = 21
, stars = TRUE
, scale = FALSE
, lm = TRUE
) library(FactoMineR)
mv <- fb %>%
group_by(riego, geno) %>%
summarise(across(where(is.numeric), ~ mean(., na.rm = TRUE))) %>%
PCA(scale.unit = T, quali.sup = c(1:4), graph = F)
p1 <- plot(mv
, choix="ind"
, habillage=1
, label = "ind"
)
p2 <- plot(mv
, choix="var")
list(p1, p2) %>%
plot_grid(plotlist = ., nrow = 1)p1 <- fb %>%
ggplot(data = ., aes(x = geno, y = hi, fill = riego)) +
geom_boxplot() +
labs(x = "Genotipos"
, y = "Indice de cosecha"
, fill = "Tratamiento"
, title ="Eficiencia de uso de agua en papa"
, subtitle = "Indice de cosecha"
, caption = "n = 150",
) +
theme_classic() +
theme(plot.title = element_text(hjust = 0.5))
p1p2 <- fb %>%
ggplot(data = .
, aes(x = twue, y = hi, color = riego)) +
geom_point() +
geom_smooth(method = lm) +
labs(x = "Efiencia de uso de agua de tuberculo"
, y = "Indice de cosecha"
, color = "Tratamiento"
, title ="Eficiencia de uso de agua en papa"
, subtitle = "Indice de cosecha vs Efiencia de uso de agua de tuberculo"
, caption = "n = 150",
) +
theme_bw()
p2modelo <- lm(lfa ~ bloque + riego*geno
, data = fb)
anova(modelo)
## Analysis of Variance Table
##
## Response: lfa
## Df Sum Sq Mean Sq F value Pr(>F)
## bloque 4 3435339 858835 1.5616 0.1892
## riego 1 788556926 788556926 1433.7957 <0.0000000000000002 ***
## geno 14 261729564 18694969 33.9922 <0.0000000000000002 ***
## riego:geno 14 108147972 7724855 14.0457 <0.0000000000000002 ***
## Residuals 116 63797516 549979
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
library(agricolae)
tukey <- HSD.test(modelo
, c("geno", "riego")
, group = TRUE)
grupos <- tukey_result$groups %>%
rownames_to_column("tratamientos") %>%
separate(tratamientos, into = c("geno", "riego")
, sep = ":")p3 <- grupos %>%
ggplot(data = .
, aes(x = geno, y = lfa, fill = riego)) +
geom_col(position = position_dodge2(preserve = "single"))
p3library(psych)
p4 <- function() {
fb %>%
select_if(is.numeric) %>%
dplyr::select(!c("block")) %>%
pairs.panels(x = .
, hist.col="red"
, pch = 21
, stars = TRUE
, scale = FALSE
, lm = TRUE
)
}
p4
## function() {
##
## fb %>%
## select_if(is.numeric) %>%
## dplyr::select(!c("block")) %>%
## pairs.panels(x = .
## , hist.col="red"
## , pch = 21
## , stars = TRUE
## , scale = FALSE
## , lm = TRUE
## )
## }library(cowplot)
plot <- list(p1, p2, p3, p4) %>%
plot_grid(plotlist = .
, ncol = 2
, labels = "auto"
)
ggsave2(filename = "plot-01.jpg", units = "cm"
, width = 30*2, height = 15*2.5)
include_graphics("plot-01.jpg")